/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ua.i.kotionokyurievna.jewelry.domain.orderitem;

import ua.i.kotionokyurievna.jewelry.domain.productcatalog.ProductCatalog;

/**
 *
 * @author Kateryna_Reznik
 */
public class OrderItem {
    private int itemId;
    private int orderId;
    private ProductCatalog productCatalog;
    private double price;
    private int quantity;
    private OrderItemStatus status;

    public OrderItem() {
    }

    public OrderItem(int orderId, ProductCatalog productCatalog, double price, 
            int quantity, OrderItemStatus status) {
        this.orderId = orderId;
        this.productCatalog = productCatalog;
        this.price = price;
        this.quantity = quantity;
        this.status = status;
    }

    public OrderItem(int itemId, int orderId, ProductCatalog productCatalog, 
            double price, int quantity, OrderItemStatus status) {
        this.itemId = itemId;
        this.orderId = orderId;
        this.productCatalog = productCatalog;
        this.price = price;
        this.quantity = quantity;
        this.status = status;
    }

    public int getItemId() {
        return itemId;
    }

    public void setItemId(int itemId) {
        this.itemId = itemId;
    }

    public int getOrderId() {
        return orderId;
    }

    public ProductCatalog getProductCatalog() {
        return productCatalog;
    }

    public void setProductCatalog(ProductCatalog productCatalog) {
        this.productCatalog = productCatalog;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public OrderItemStatus getStatus() {
        return status;
    }

    public void setStatus(OrderItemStatus status) {
        this.status = status;
    }

    @Override
    public String toString() {
        return "OrderItem{" + "itemId=" + itemId + ", orderId=" + orderId + 
                ", productCatalog=" + productCatalog + ", price=" + price + 
                ", quantity=" + quantity + ", status=" + status + '}';
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 73 * hash + this.orderId;
        hash = 73 * hash + (this.productCatalog != null ? 
                this.productCatalog.hashCode() : 0);
        hash = 73 * hash + (int) (Double.doubleToLongBits(this.price) ^ 
                (Double.doubleToLongBits(this.price) >>> 32));
        hash = 73 * hash + this.quantity;
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final OrderItem other = (OrderItem) obj;
        if (this.orderId != other.orderId) {
            return false;
        }
        if (this.productCatalog != other.productCatalog && 
                (this.productCatalog == null || 
                !this.productCatalog.equals(other.productCatalog))) {
            return false;
        }
        if (Double.doubleToLongBits(this.price) != Double.doubleToLongBits(other.price)) {
            return false;
        }
        if (this.quantity != other.quantity) {
            return false;
        }
        return true;
    }
    
    
}
